package com.newly.driver.mqtt.service;

import cn.hutool.json.JSONUtil;
import com.newly.api.business.feign.MQTTReceiverClient;

public class AsynReceiver implements Runnable {
    private Thread thread;
    private String topic;
    private String message;
    private MQTTReceiverClient mqttReceiverClient;

    AsynReceiver(String topic,String message,MQTTReceiverClient mqttReceiverClient) {
        this.message = message;
        this.topic = topic;
        this.mqttReceiverClient = mqttReceiverClient;
    }

    @Override
    public void run() {
        mqttReceiverClient.setVehicleInfo(topic, JSONUtil.toJsonStr(message));
    }
    public void start () {
        Thread thread = new Thread (this);
        thread.start ();
    }
}
